package com.gome.ocean.common.enums;

/**
 * @author zhangguoqing 2016年12月7日 下午10:27:14
 * @since 5.0.0
 */
public enum ColumnTypeEnum {

    BINARY("binary"), SMALLINT("smallint"), TINYINT("tinyint"), INT("int"), BIGINT("bigint"), FLOAT("float"),
                            DOUBLE("double"), BLOB("blob"), LONGBLOB("longblob"), CHAR("char"), VARCHAR("varchar"),
                            VARCHAR2("varchar2"), DATE("date"), DATETIME("datetime"), NUMBER("number"),
                            TIMESTAMP("timestamp"), TEXT("text"), DECIMAL("decimal"), BIT("bit"), BOOLEAN("boolean"),
                            BOOL("bool"), TIME("time"), YEAR("year"), LONGTEXT("longtext"), ENUM("enum"), SET("set"),
                            CLOB("clob"), RAW("raw"), INTERVALSECOND("interval day to second"),
                            INTERVALMONTH("interval year to month");

    private String value;

    ColumnTypeEnum(String value){
        this.value = value;
    }

    public static ColumnTypeEnum getColumnType(String value) {
        for (ColumnTypeEnum typeVal : ColumnTypeEnum.values()) {
            if (typeVal.getValue().equals(value)) {
                return typeVal;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }
}
